﻿using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace DesktopToyWpf.Convertors;

/// <summary>
/// 非 0 值转可见
/// </summary>
public class NotZeroToVisibleConvertor : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is int intValue && intValue != 0)
        {
            return Visibility.Visible;
        }

        return Visibility.Collapsed;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotSupportedException();
    }
}